package org.jivesoftware.openfire.plugin.listener;

import org.jivesoftware.openfire.event.SessionEventListener;
import org.jivesoftware.openfire.session.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 客户端用户的 session监听
 * <p>
 * 用户登录的时候,从数据库查询用户加入的房间. 创建session,自动把用户加入房间
 */
public class SessionEventListenerImpl implements SessionEventListener {

    private static final Logger log = LoggerFactory.getLogger(SessionEventListenerImpl.class);

    /**
     * 用户登录时
     */
    @Override
    public void sessionCreated(Session session) {
        log.info("用户登录成功：{}", session.getAddress());
    }

    @Override
    public void sessionDestroyed(Session session) {
        log.info("用户退出服务器成功：{}",session.getAddress());
    }

    @Override
    public void anonymousSessionCreated(Session session) {
        // TODO Auto-generated method stub

    }

    @Override
    public void anonymousSessionDestroyed(Session session) {
        // TODO Auto-generated method stub

    }

    @Override
    public void resourceBound(Session session) {
        // TODO Auto-generated method stub

    }

}
